package com.kaishengit.web;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.kaishengit.pojo.Sales;
import com.kaishengit.service.SalesService;

@Controller
public class SalesController {
	private SalesService salesService;
	
	@RequestMapping("/salesList")
	public String findAll(Model model){
		List<Sales> salesList = salesService.findAll();
		model.addAttribute("salesList", salesList);
		return "salesList";
	}
	@RequestMapping("/saleslist")
	public String findByWhere(Model model,Sales sales){
		List<Sales> salesList = salesService.findByWhere(sales);
		model.addAttribute("salesList", salesList);
		return "salesList";
	}
	@RequestMapping("/addSales")
	public String add(Sales sales){
		salesService.add(sales);
		return "redirect:/sales";
	}

	@Autowired
	public void setSalesService(SalesService salesService) {
		this.salesService = salesService;
	}
	
	

}
